package com.es.www.kyl.controller.web;

import com.es.www.kyl.bean.R;
import com.es.www.kyl.bean.req.web.QuestionAddReq;
import com.es.www.kyl.bean.req.web.QuestionAuditReq;
import com.es.www.kyl.bean.req.web.QuestionReq;
import com.es.www.kyl.bean.req.web.QuestionUpdateReq;
import com.es.www.kyl.bean.res.web.QuestionListVO;
import com.es.www.kyl.service.QuestionService;
import com.github.pagehelper.PageInfo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;

/**
 * @author Estranger
 * @date 2025/7/31
 * description
 */
@Api(tags = "题目模块")
@RequiredArgsConstructor
@RestController
@RequestMapping("/web/question")
public class QuestionController {

	private final QuestionService questionService;

	@ApiOperation("题目列表")
	@PostMapping("/pageQueryQuestionList")
	public R<PageInfo<QuestionListVO>> pageQueryQuestionList(@RequestBody QuestionReq req) {
		return R.successResponse(questionService.pageQueryQuestionList(req));
	}

	@ApiOperation("添加题目")
	@PostMapping("/addQuestion")
	public R<Void> addQuestion(@RequestBody QuestionAddReq req) {
		questionService.addQuestion(req);
		return R.successCommonResponse();
	}

	@ApiOperation("删除题目")
	@PostMapping("/deleteQuestion")
	public R<Void> deleteQuestion(@RequestParam Integer questionId) {
		questionService.deleteQuestion(questionId);
		return R.successCommonResponse();
	}

	@ApiOperation("审核题目")
	@PostMapping("/auditQuestion")
	public R<Void> auditQuestion(@RequestBody QuestionAuditReq req) {
		questionService.auditQuestion(req);
		return R.successCommonResponse();
	}

	@ApiOperation("修改题目")
	@PostMapping("/updateQuestion")
	public R<Void> updateQuestion(@RequestBody QuestionUpdateReq req) {
		questionService.updateQuestion(req);
		return R.successCommonResponse();
	}



}
